package com.wskj.controller.home;

import com.wskj.common.core.controller.BaseController;
import com.wskj.common.core.domain.AjaxResult;
import com.wskj.common.core.page.TableDataInfo;
import com.wskj.common.utils.tool.Query;
import com.wskj.workbench.bo.app.AppRankQueryBo;
import com.wskj.workbench.bo.app.AppRankTypeQueryBo;
import com.wskj.workbench.bo.app.AppSearchQueryBo;
import com.wskj.workbench.service.ITbUserWalletDetailService;
import com.wskj.workbench.vo.app.AppCurrentRankVo;
import com.wskj.workbench.vo.app.AppRankVo;
import com.wskj.workbench.vo.app.AppSearchVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "【首页】相关接口")
@AllArgsConstructor
@RestController
@RequestMapping("/api/home")
public class ApiHomeController extends BaseController {

    private final ITbUserWalletDetailService tbUserWalletDetailService;


    @ApiOperation("查询某个用户的直播收益和短视频收益")
    @GetMapping("/search")
    public AjaxResult<AppSearchVo> search(@Validated AppSearchQueryBo bo) {
        AppSearchVo search = tbUserWalletDetailService.search(bo);
        return AjaxResult.success(search);
    }

    @ApiOperation("各种收益的排名")
    @GetMapping("/type/page")
    public TableDataInfo<AppRankVo> getTypePage(Query query, @Validated AppRankTypeQueryBo bo) {
        return tbUserWalletDetailService.getTypePage(query, bo);
    }


    @ApiOperation("收益排行")
    @GetMapping("/rank/page")
    public TableDataInfo<AppRankVo> getRankPage(Query query, @Validated AppRankQueryBo bo) {
        return tbUserWalletDetailService.getRankPage(query, bo);
    }


    @ApiOperation("查询当前用户在收益排行中的排名")
    @GetMapping("/rank/current")
    public AjaxResult<AppCurrentRankVo> getRankCurrent(@Validated AppRankQueryBo bo) {
        AppCurrentRankVo rankCurrent = tbUserWalletDetailService.getRankCurrent(bo);
        return AjaxResult.success(rankCurrent);
    }


}
